package com.pj.wisdomlogistics.ui.activity;

import android.support.annotation.IdRes;
import android.support.v4.content.ContextCompat;
import android.widget.RadioGroup;

import com.pj.wisdomlogistics.R;
import com.pj.wisdomlogistics.other.EventCenter;
import com.pj.wisdomlogistics.ui.adapter.MainPagerAdapter;
import com.pj.wisdomlogistics.ui.view.AutoRadioGroup;
import com.pj.wisdomlogistics.ui.view.XViewPager;

import butterknife.BindView;

public class OldMainActivity extends BaseActivity implements RadioGroup.OnCheckedChangeListener {
    @BindView(R.id.vp_main)
    XViewPager mVpMain;
    @BindView(R.id.rg_main)
    AutoRadioGroup mRgMain;

    @Override
    public void initView() {
        ultimateBar.setColorBar(ContextCompat.getColor(this , R.color.text_blue));

        mVpMain.setAdapter(new MainPagerAdapter(getSupportFragmentManager()));
        mVpMain.setOffscreenPageLimit(3);
        mRgMain.setOnCheckedChangeListener(this);
    }

    @Override
    public void initData() {

    }

    @Override
    public int getContentView() {
        return R.layout.activity_main;
    }

    @Override
    public boolean isApplyEventBus() {
        return false;
    }

    @Override
    public boolean isApplyButterKnife() {
        return true;
    }

    @Override
    public void onEventCome(EventCenter eventCenter) {

    }

    @Override
    public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
        switch (checkedId){
            case R.id.rb_wls:
                mVpMain.setCurrentItem(0 , false);
                break;
            case R.id.rb_sl:
                mVpMain.setCurrentItem(1 , false);
                break;
            case R.id.rb_pc:
                mVpMain.setCurrentItem(2 , false);
                break;
        }
    }
}
